package com.heima.article.feign;

import com.heima.apis.article.IArticleClient;
import com.heima.article.service.ApArticleService;
import com.heima.article.service.ApAuthorServise;
import com.heima.model.article.dtos.ArticleDto;
import com.heima.model.article.pojos.ApAuthor;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmChannelDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ArticleClient implements IArticleClient {

    @Autowired
    private ApArticleService apArticleService;

    @Autowired
    private ApAuthorServise apAuthorServise;;


    @PostMapping("/api/v1/article/save")
    @Override
    public ResponseResult saveAppArticle(ArticleDto dto) {
        return apArticleService.saveAppArticle(dto);
    }

    @PostMapping("/api/v1/article/register")
    @Override
    public ResponseResult register(ApAuthor apAuthor) {
        System.out.println("文章账户创建参数:"+apAuthor);
        return apAuthorServise.register(apAuthor);
    }



    @Override
    @PostMapping("/api/v1/article/lookChannelName")
    public ResponseResult lookChannelName(WmChannelDto wmChanne) {
        return apArticleService.lookChannelName(wmChanne);
    }
}
